/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package gestionmagasins_aspectj_junit_patterns.model;

//Classe singleton
public class Securite 
{
	private Usager currentUsager;
	
    private Securite()
    {
    	currentUsager = null;
    }
    
    private static class CatalogueHolder//Holder pour un singleton thread safe 
    {
        static final Securite INSTANCE = new Securite();
    }
    
    public static Securite getInstance()
    {
        return CatalogueHolder.INSTANCE;
    }
    
    public Usager getCurrentUsager()
    {
    	return currentUsager;
    }
    
    public void login(Usager usager)
    {
    	currentUsager = usager;
    }
    
    public void logout()
    {
    	currentUsager = null;
    }
}
